<?php
namespace app\common\model\user;

use app\common\model\TimeModel;

class Topic extends TimeModel
{
    protected $deleteTime = 'delete_time';

    public function getImageAttr($value){
        return explode(',',$value);
    }

    //获取用户信息
    public function user(){
        return $this->belongsTo('app\common\model\user\WxUsers','user_id','id')->field('id,nick_name');
    }
    public static function onAfterInsert($data){

        //$self = new static();
        $article = self::withoutGlobalScope()->find($data->id);

        $article->withoutGlobalScope()->where('id',$data->id)->save(['app_id'=>self::get_appId()]);

    }
}